package com.css.fxfzxczh.modules.synthesizeInfoManage.matManage.verify;

import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult;
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
import com.css.fxfzxczh.base.dict.service.DictService;
import com.css.fxfzxczh.modules.synthesizeInfoManage.matManage.vo.MatManageImportVo;
import com.css.fxfzxczh.util.PlatformObjectUtils;
import com.css.fxfzxczh.zcpt.sys.service.SysAreaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class MatManageExcelVerify implements IExcelVerifyHandler<MatManageImportVo> {



    @Override
    public ExcelVerifyHandlerResult verifyHandler(MatManageImportVo matManageImportVo) {
        ExcelVerifyHandlerResult result = new ExcelVerifyHandlerResult(true);
        StringBuilder message = new StringBuilder("");



        if (PlatformObjectUtils.isEmpty(matManageImportVo.getMaterialName())) {
            result.setSuccess(false);
            message.append("物资名称 不能为空！");
        }else{
            if(matManageImportVo.getMaterialName().length()>30){
                result.setSuccess(false);
                message.append("物资名称 不得超过30字！");
            }
        }

        if (PlatformObjectUtils.isEmpty(matManageImportVo.getCategory())) {
            result.setSuccess(false);
            message.append("物资类型 不能为空！");
        }
        if (PlatformObjectUtils.isEmpty(matManageImportVo.getQuantity())) {
            result.setSuccess(false);
            message.append("物资数量 不能为空！");
        }
        if (PlatformObjectUtils.isNotEmpty(matManageImportVo.getCommentInfo())) {
            if(matManageImportVo.getCommentInfo().length()>1000){
                result.setSuccess(false);
                message.append("描述信息 不得超过1000字！");
            }
        }









        result.setMsg(message.toString());
        return result;
    }

}
